import mimetypes

from django import template
register = template.Library()

@register.filter(name='mimetype')
def mimetype(file_obj):
    return mimetypes.guess_type(file_obj)[0]

